<template>
    <div style="height: 100%; position: relative">
        <el-drawer
			:title="title"
            :before-close="handleClose"
            :visible.sync="show_dialog"
            direction="rtl"
			size="88%"
            custom-class="demo-drawer"
            ref="add"
            class="head-box"
        >     
            <div class="demo-drawer__content addstore">
                <el-row>
                <el-form :model="form" ref="form" id="form">
                    <div>
                        <div class="main-title">主体类型:</div>
                        <el-form-item
                            :label-width="formLabelWidth"   
                            prop="organization_type"                        
                            :rules="[
                            { required: true, message: '请选择主体类型', trigger: 'blur' }
                            ]">
                            <span class="start">*</span>
                            <span>主体类型：</span>                            
                            <el-select  v-model="form.organization_type" placeholder="请选择">
                                <el-option
                                v-for="item in mainlist"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <div  v-if="form.organization_type == 4||form.organization_type == 2||form.organization_type == 3||form.organization_type == 1708">
                        <div class="main-title">营业执照/登记证书信息:</div>
                        <el-form-item 
                            :label-width="formLabelWidth"
                            prop="business_license_info.business_license_copy"
                            :rules="[
                            { required: true, message: '请上传证件扫描件', trigger: 'blur' }
                            ]">
                            <span class="start">*</span>
                            <span>证件扫描件：</span>
                                <el-upload
                                class="upload-demo"
                                :file-list="fileList1"
                                action="#"
                                :on-change="(file, fileList1)=>handlePreview(file, fileList1,'business_license_copy')"
                                :on-remove="handleRemove"
                                list-type="picture-card"
                                :limit="1"
                                :on-exceed="fileExceed"
                                :auto-upload="false">
                                <i class="el-icon-plus"></i>
                                </el-upload>
                                <div class="icon-image">
                                    <img src="./img/ts.png" alt="提示">
                                    <div class="prompt-icon">
                                        图片要求：
                                        （1）请上传证件的彩色扫描件或彩色数码拍摄件，黑白复印件需加盖公章（公章信息需完整） 。
                                        （2）不得添加无关水印（非微信支付商户申请用途的其他水印）。
                                        （3）需提供证件的正面拍摄件，完整、照面信息清晰可见。信息不清晰、扭曲、压缩变形、反光、不完整均不接受。
                                        （4）不接受二次剪裁、翻拍、PS的证件照片。                               
                                    </div>                                   
                                </div>                               
                        </el-form-item>    
                        <div>
                        </div>                     
                        <el-form-item
                            prop="business_license_info.business_license_number"        
                            :label-width="formLabelWidth"                 
                            :rules="[{ required: true, message: '请输入证件注册号', trigger: 'blur' }]">
                        <span class="start">*</span>
                        <span>证件注册号：</span>
                            <el-input
                                v-model="form.business_license_info.business_license_number"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                            <div class="icon-image">
                                <img src="./img/ts.png" alt="提示">
                                <div class="prompt-icon">
                                    1、主体为“个体工商户/企业”时，请填写营业执照上的注册号/统一社会信用代码，须为15位数字或 18位数字|大写字母。
                                    2、主体为“党政、机关及事业单位/其他组织”时，请填写登记证书的证书编号。                               
                                </div>                                   
                            </div>                            
                        </el-form-item>
                        <el-form-item
                            prop="business_license_info.merchant_name"
                            :label-width="formLabelWidth"
                            :rules="[
                            { required: true, message: '请输入商户名称', trigger: 'blur' }
                            ]"
                            >
                        <span class="start">*</span>     
                        <span>商户名称：</span>
                            <el-input
                                v-model="form.business_license_info.merchant_name"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                            <div class="icon-image">
                                <img src="./img/ts.png" alt="提示">
                                <div class="prompt-icon">
                                    1、请填写营业执照/登记证书的商家名称，2~110个字符，支持括号 。
                                    2、个体工商户/党政、机关及事业单位，不能以“公司”结尾。
                                    3、个体工商户，若营业执照上商户名称为空或为“无”，请填写"个体户+经营者姓名"，如“个体户张三” 。                               
                                </div>                                   
                            </div>
                        </el-form-item>
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="business_license_info.legal_person"
                            :rules="[
                            { required: true, message: '请输入经营者/法人代表人姓名', trigger: 'blur' }
                            ]">
                        <span class="start">*</span>     
                        <span>经营者/法人代表人姓名：</span>
                            <el-input
                                v-model="form.business_license_info.legal_person"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="business_license_info.company_address"
                            :rules="[
                            {required:form.organization_type==3||form.organization_type==1708?true:false, message: '请输入注册地址', trigger: 'blur' },
                            ]">
                        <span class="start">*</span>    
                            <span>注册地址：</span>
                            <el-input
                                v-model="form.business_license_info.company_address"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item>  
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="business_license_info.business_time"
                            :rules="[
                            {required:form.organization_type==3||form.organization_type==1708?true:false, message: '请输入营业期限', trigger: 'blur' },
                            ]">
                        <span class="start">*</span>    
                            <span>营业期限：</span>
                            <el-input
                                v-model="form.business_license_info.business_time"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                            <div class="icon-image">
                                <img src="./img/ts.png" alt="提示">
                                <div class="prompt-icon">
                                    1、主体为“党政、机关及事业单位/其他组织”时必填，请填写证件有效期。
                                    2、若证件有效期为长期，请填写：长期。
                                    3、结束时间需大于开始时间。
                                    4、有效期必须大于60天，即结束时间距当前时间需超过60天。                               
                                </div>                                   
                            </div>                             
                        </el-form-item>                          
                        </div>
                        <div v-if="form.business_license_info.business_license_number&&form.business_license_info.business_license_number.length!=18">
                        <div class="main-title">组织机构代码证信息:</div>  
                        <el-form-item 
                            :label-width="formLabelWidth"
                            prop="organization_cert_info.organization_copy"
                            :rules="[
                            { required: true, message: '请上传组织机构代码证照片', trigger: 'blur' }
                            ]"
                        >
                            <span class="start">*</span>
                            <span>组织机构代码证照片：</span>
                                <el-upload
                                class="upload-demo"
                                :file-list="fileList2"
                                action="#"
                                :on-change="(file, fileList2)=>handlePreview(file, fileList2,'organization_copy')"
                                :on-remove="handleRemove"
                                list-type="picture-card"
                                :limit="1"
                                :on-exceed="fileExceed"
                                :auto-upload="false">
                                <i class="el-icon-plus"></i>
                                </el-upload>
                        </el-form-item>                                                                       
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="organization_cert_info.organization_number"
                            :rules="[
                            { required: true, message: '请输入组织机构代码', trigger: 'blur' },
                            ]"
                            >
                            <span class="start">*</span>
                            <span>组织机构代码：</span>
                            <el-input
                                v-model="form.organization_cert_info.organization_number"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="organization_cert_info.organization_time"
                            :rules="[
                            { required: true, message: '请输入组织机构代码有效期', trigger: 'blur' },
                            ]">
                            <span class="start">*</span>
                            <span>组织机构代码有效期：</span>
                            <el-input
                                v-model="form.organization_cert_info.organization_time"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                            <div class="icon-image">
                                <img src="./img/ts.png" alt="提示">
                                <div class="prompt-icon">
                                    1、请填写组织机构代码证的有效期限，注意参照示例中的格式。
                                    2、若证件有效期为长期，请填写：长期。
                                    3、结束时间需大于开始时间。
                                    4、有效期必须大于60天，即结束时间距当前时间需超过60天。                              
                                </div>                                   
                            </div>                             
                        </el-form-item> 
                        </div> 
                        <div class="main-title">经营者/法人证件类型:</div>
                        <el-form-item
                            :label-width="formLabelWidth"    
                            prop="id_doc_type"                   
                            :rules="[
                            { required: true, message: '请选择经营者/法人证件类型', trigger: 'blur' }
                            ]">
                            <span class="start">*</span>
                            <span>经营者/法人证件类型：</span>                            
                            <el-select v-model="form.id_doc_type" placeholder="请选择">
                                <el-option
                                v-for="item in Certificate"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>  
                        <div v-if="form.id_doc_type == 'IDENTIFICATION_TYPE_MAINLAND_IDCARD'">
                        <div class="main-title">经营者/法人身份证信息:</div>
                        <el-form-item 
                            :label-width="formLabelWidth"
                            prop="id_card_info.id_card_copy"
                            :rules="[
                            { required:true, message: '请上传身份证人像面照片', trigger: 'blur' }
                            ]"                            
                        >
                            <span class="start">*</span>
                            <span>身份证人像面照片：</span>
                                <el-upload
                                class="upload-demo"
                                :file-list="fileList3"
                                action="#"
                                :on-change="(file, fileList3)=>handlePreview(file, fileList3,'id_card_copy')"
                                :on-remove="handleRemove"
                                list-type="picture-card"
                                :limit="1"
                                :on-exceed="fileExceed"
                                :auto-upload="false">
                                <i class="el-icon-plus"></i>
                                </el-upload>
                        </el-form-item> 
                        <el-form-item 
                            :label-width="formLabelWidth"
                            prop="id_card_info.id_card_national"
                            :rules="[
                            { required:true, message: '请上传身份证国徽面照片', trigger: 'blur' }
                            ]">
                            <span class="start">*</span>
                            <span>身份证国徽面照片：</span>
                                <el-upload
                                class="upload-demo"
                                :file-list="fileList4"
                                action="#"
                                :on-change="(file, fileList4)=>handlePreview(file, fileList4,'id_card_national')"
                                :on-remove="handleRemove"
                                list-type="picture-card"
                                :limit="1"
                                :on-exceed="fileExceed"
                                :auto-upload="false">
                                <i class="el-icon-plus"></i>
                                </el-upload>
                        </el-form-item>                                                                                            
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="id_card_info.id_card_name"
                            :rules="[
                            { required: true, message: '请输入身份证姓名', trigger: 'blur' },
                            ]"
                            >
                            <span class="start">*</span>
                            <span>身份证姓名：</span>
                            <el-input
                                v-model="form.id_card_info.id_card_name"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item> 
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="id_card_info.id_card_number"
                            :rules="[
                            { required: true, message: '请输入身份证号码', trigger: 'blur' },
                            {pattern: /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/,message: '证件号码格式有误！', trigger: 'blur'}                            
                            ]">
                            <span class="start">*</span>
                            <span>身份证号码：</span>
                            <el-input
                                v-model="form.id_card_info.id_card_number"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item>
                      <el-form-item
                            :label-width="formLabelWidth"
                            prop="id_card_info.id_card_valid_time_begin"
                            :rules="[
                            { required: true, message: '身份证有效期开始时间', trigger: 'blur' },
          
                            ]">
                            <span class="start">*</span>
                            <span>身份证有效期开始时间：</span>
                            <el-input
                                v-model="form.id_card_info.id_card_valid_time_begin"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>                           
                        </el-form-item>                         
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="id_card_info.id_card_valid_time"
                            :rules="[
                            { required: true, message: '请输入身份证有效期限', trigger: 'blur' },
          
                            ]">
                            <span class="start">*</span>
                            <span>身份证有效期限：</span>
                            <el-input
                                v-model="form.id_card_info.id_card_valid_time"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                             <div class="icon-image">
                                <img src="./img/ts.png" alt="提示">
                                <div class="prompt-icon">
                                    1、请填写身份证有效期的结束时间，注意参照示例中的格式。
                                    2、若证件有效期为长期，请填写：长期。
                                    3、证件有效期需大于60天。                              
                                </div>                                   
                            </div>                            
                        </el-form-item> 
                        <el-form-item
                                :label-width="formLabelWidth"
                                prop="id_card_info.id_card_address"
                                :rules="[
                                { required: true, message: '身份证居住地址', trigger: 'blur' },
            
                                ]">
                                <span class="start">*</span>
                                <span>身份证居住地址：</span>
                                <el-input
                                    v-model="form.id_card_info.id_card_address"
                                    autocomplete="off"
                                    @input="changeinput($event)"
                                ></el-input>                           
                            </el-form-item>                          
                        </div>
                        <div v-if="form.id_doc_type == 'IDENTIFICATION_TYPE_OVERSEA_PASSPORT'||form.id_doc_type == 'IDENTIFICATION_TYPE_MACAO'||form.id_doc_type == 'IDENTIFICATION_TYPE_HONGKONG'||form.id_doc_type == 'IDENTIFICATION_TYPE_TAIWAN'">
                        <div class="main-title">经营者/法人其他类型证件信息:</div>
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="id_doc_info.id_doc_name"
                            :rules="[
                            { required: true, message: '请输入证件姓名', trigger: 'blur' },
                            ]">
                            <span class="start">*</span>
                            <span>证件姓名：</span>
                            <el-input
                                v-model="form.id_doc_info.id_doc_name"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item>  
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="id_doc_info.id_doc_number"
                            :rules="[
                            { required: true, message: '请输入证件号码', trigger: 'blur' },
                            ]">
                            <span class="start">*</span>
                            <span>证件号码：</span>
                            <el-input
                                v-model="form.id_doc_info.id_doc_number"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item 
                           :label-width="formLabelWidth"
                           prop="id_doc_info.id_doc_copy"
                            :rules="[
                            { required: true, message: '请上传证件照片', trigger: 'blur' }
                            ]"
                        >
                            <span class="start">*</span>
                            <span>证件照片：</span>
                                <el-upload
                                class="upload-demo"
                                :file-list="fileList5"
                                action="#"
                                :on-change="(file, fileList5)=>handlePreview(file, fileList5,'id_doc_copy')"
                                :on-remove="handleRemove"
                                list-type="picture-card"
                                :limit="1"
                                :on-exceed="fileExceed"
                                :auto-upload="false">
                                <i class="el-icon-plus"></i>
                                </el-upload>
                        </el-form-item>                        
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="id_doc_info.doc_period_end"
                            :rules="[
                            { required: true, message: '请输入证件结束日期', trigger: 'blur' },
                            ]">
                            <span class="start">*</span>
                            <span>证件结束日期：</span>
                            <el-input
                                v-model="form.id_doc_info.doc_period_end"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                             <div class="icon-image">
                                <img src="./img/ts.png" alt="提示">
                                <div class="prompt-icon">
                                    1、请填写身份证有效期的结束时间，注意参照示例中的格式。
                                    2、若证件有效期为长期，请填写：长期。
                                    3、证件有效期需大于60天。                              
                                </div>                                   
                            </div>                             
                        </el-form-item> 
                        </div>
                      </div>  
                      <div>      
                        <div class="main-title">结算银行账户:</div>                  
                        <el-form-item
                            :label-width="formLabelWidth"       
                            prop="need_account_info"               
                            :rules="[
                            { required: true, message: '请选择主体类型', trigger: 'blur' }
                            ]">
                            <span class="start">*</span>
                            <span>是否结算银行账户：</span>                            
                            <el-select v-model="form.need_account_info" placeholder="请选择" disabled>
                                <el-option
                                v-for="item in accountlist"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <div v-if="form.need_account_info==true">
                        <el-form-item
                            :label-width="formLabelWidth"    
                            prop="account_info.bank_account_type"                       
                            :rules="[
                            { required: true, message: '请选择主体类型', trigger: 'blur' }
                            ]">
                            <span class="start">*</span>
                            <span>账户类型：</span>                            
                            <el-select v-model="form.account_info.bank_account_type" placeholder="请选择">
                                <el-option
                                v-for="item in banktype"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>  
                        <el-form-item
                            :label-width="formLabelWidth"    
                            prop="account_info.account_bank"                       
                            :rules="[
                            { required: true, message: '请选择开户银行', trigger: 'blur' }
                            ]">
                            <span class="start">*</span>
                            <span>开户银行：</span>                            
                            <el-select v-model="form.account_info.account_bank" placeholder="请选择">
                                <el-option
                                v-for="item in banklist"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="account_info.account_name"
                            :rules="[
                            { required: true, message: '请输入开户名称', trigger: 'blur' },
                            ]">
                            <span class="start">*</span>
                            <span>开户名称：</span>
                            <el-input
                                v-model="form.account_info.account_name"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                            <div class="icon-image">
                                <img src="./img/ts.png" alt="提示">
                                <div class="prompt-icon">
                                    1、选择经营者个人银行卡时，开户名称必须与身份证姓名一致。
                                    2、选择对公账户时，开户名称必须与营业执照上的“商户名称”一致。                              
                                </div>                                   
                            </div>
                        </el-form-item> 
                        <el-form-item
                            :label-width="formLabelWidth">
                            <span class="start">*</span>
                            <span>开户银行省市编码：</span>
                            <!-- <el-col :span="4"> -->
                            <el-form-item
                            prop = "account_info.bank_address_code"
                            :rules="[
                            {  required: form.account_info.bank_address_code!=''?false:true, message: '请选择开户银行所在省或市', trigger: 'blur' },
                            ]">
                                <el-select v-model="province_code" placeholder="请选择省"  @change="changeProv">
                                <el-option v-for="item in addresslist" :key="item.national_code" :label="item.region_name" :value="item.national_code"></el-option>
                                </el-select>
                            </el-form-item>
                            <!-- </el-col> -->
                            <!-- <el-col :span="4"> -->
                            <el-form-item v-if="province_child!=''&&province_child!=undefined&&province_child!=null"
                                prop="account_info.bank_address_code"
                                :rules="[
                                { required: form.account_info.bank_address_code!=''?false:true, message: '请选择开户银行所在市或区', trigger: 'blur' },
                                ]">
                                <el-select v-model="city_code" placeholder="请选择市" @change="changeCity">
                                <el-option v-for="item in  province_child" :key="item.national_code" :label="item.region_name" :value="item.national_code"></el-option>
                                </el-select>
                            </el-form-item>
                            <!-- </el-col> -->
                            <!-- <el-col :span="4" > -->
                            <el-form-item v-if="city_child!=''&&city_child!=undefined&&city_child!=null"
                                prop="account_info.bank_address_code">
                                <el-select v-model="area_code" placeholder="请选择区域" @change="changeArea">
                                <el-option
                                    v-for="item in city_child"
                                    :key="item.national_code"
                                    :label="item.region_name"
                                    :value="item.national_code"
                                ></el-option>
                                </el-select>
                            </el-form-item>
                            <!-- </el-col> -->
                        </el-form-item>          
                        <!-- <el-form-item
                            :label-width="formLabelWidth"
                            prop="account_info.bank_branch_id"
                            :rules="[
                            {required:form.account_info.account_bank=='其他银行'? true:false,message: '请输入开户银行联行号', trigger: 'blur' },
                            ]">
                            <span class="start">*</span>
                            <span>开户银行联行号：</span>
                            <el-input
                                v-model="form.account_info.bank_branch_id"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item>  -->
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="account_info.bank_name"
                            :rules="[
                            {required:form.account_info.account_bank=='其他银行'? true:false,message: '请输入开户银行全称（含支行）', trigger: 'blur' },
                            ]">
                            <span>开户银行全称(含支行)：</span>
                            <el-input
                                v-model="form.account_info.bank_name"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item> 
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="account_info.account_number"
                            :rules="[
                            { required: true, message: '请输入银行账号', trigger: 'blur' },
                            ]">
                            <span class="start">*</span>
                            <span>银行帐号：</span>
                            <el-input
                                v-model="form.account_info.account_number"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item> 
                        </div>
                        <div class="main-title">超级管理员信息:</div>
                        <el-form-item
                            :label-width="formLabelWidth"        
                            prop="contact_info.contact_type"                    
                            :rules="[
                            { required: true, message: '请选择超级管理员类型', trigger: 'blur' }
                            ]">
                            <span class="start">*</span>
                            <span>超级管理员类型：</span>                            
                            <el-select v-model="form.contact_info.contact_type" placeholder="请选择">
                                <el-option
                                v-for="item in contactlist"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item
                            :label-width="formLabelWidth"        
                            prop="contact_info.contact_id_doc_type" 
                            v-if="form.contact_info.contact_type==66"                   
                            :rules="[
                            { required: true, message: '超级管理员证件类型', trigger: 'blur' }
                            ]">
                            <span class="start">*</span>
                            <span>超级管理员证件类型：</span>                            
                            <el-select v-model="form.contact_info.contact_id_doc_type" placeholder="请选择" disabled>
                                <el-option
                                v-for="item in Certificate"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item 
                            :label-width="formLabelWidth"
                            prop="contact_info.contact_id_doc_copy"
                            v-if="form.contact_info.contact_type==66"      
                            :rules="[
                            { required:true, message: '请上传超级管理员证件正面照片', trigger: 'blur' }
                            ]"                            
                        >
                            <span class="start">*</span>
                            <span>超级管理员证件正面照片：</span>
                                <el-upload
                                class="upload-demo"
                                :file-list="fileList8"
                                action="#"
                                :on-change="(file, fileList8)=>handlePreview(file, fileList8,'contact_id_doc_copy')"
                                :on-remove="(file, fileList8)=>handleRemove(file, fileList8,'contact_id_doc_copy')"
                                list-type="picture-card"
                                :limit="1"
                                :on-exceed="fileExceed"
                                :auto-upload="false">
                                <i class="el-icon-plus"></i>
                                </el-upload>
                        </el-form-item> 
                        <el-form-item 
                            :label-width="formLabelWidth"
                            prop="contact_info.contact_id_doc_copy_back"
                            v-if="form.contact_info.contact_type==66"      
                            :rules="[
                            { required:true, message: '请上传超级管理员证件反面照片', trigger: 'blur' }
                            ]">
                            <span class="start">*</span>
                            <span>超级管理员证件反面照片：</span>
                                <el-upload
                                class="upload-demo"
                                :file-list="fileList9"
                                action="#"
                                :on-change="(file, fileList9)=>handlePreview(file, fileList9,'contact_id_doc_copy_back')"
                                :on-remove="(file, fileList9)=>handleRemove(file, fileList9,'contact_id_doc_copy_back')"
                                list-type="picture-card"
                                :limit="1"
                                :on-exceed="fileExceed"
                                :auto-upload="false">
                                <i class="el-icon-plus"></i>
                                </el-upload>
                        </el-form-item>      
                      <el-form-item
                            :label-width="formLabelWidth"
                            prop="contact_info.contact_id_doc_period_begin"
                            v-if="form.contact_info.contact_type==66"      
                            :rules="[
                            { required: true, message: '超级管理员证件有效期开始时间', trigger: 'blur' },
          
                            ]">
                            <span class="start">*</span>
                            <span>超级管理员证件有效期开始时间：</span>
                            <el-input
                                v-model="form.contact_info.contact_id_doc_period_begin"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>                           
                        </el-form-item>                         
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="contact_info.contact_id_doc_period_end"
                            v-if="form.contact_info.contact_type==66"      
                            :rules="[
                            { required: true, message: '超级管理员证件有效期结束时间', trigger: 'blur' },
          
                            ]">
                            <span class="start">*</span>
                            <span>超级管理员证件有效期结束时间：</span>
                            <el-input
                                v-model="form.contact_info.contact_id_doc_period_end"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                             <div class="icon-image">
                                <img src="./img/ts.png" alt="提示">
                                <div class="prompt-icon">
                                    1、请填写身份证有效期的结束时间，注意参照示例中的格式。
                                    2、若证件有效期为长期，请填写：长期。
                                    3、证件有效期需大于60天。                              
                                </div>                                   
                            </div>                            
                        </el-form-item>        
                        <el-form-item 
                            :label-width="formLabelWidth"
                            prop="contact_info.business_authorization_letter"
                            v-if="form.contact_info.contact_type==66"      
                            :rules="[
                            { required:true, message: '请上传业务办理授权函', trigger: 'blur' }
                            ]">
                            <span class="start">*</span>
                            <span>业务办理授权函：</span>
                                <el-upload
                                class="upload-demo"
                                :file-list="fileList10"
                                action="#"
                                :on-change="(file, fileList10)=>handlePreview(file, fileList10,'business_authorization_letter')"
                                :on-remove="(file, fileList10)=>handleRemove(file, fileList10,'business_authorization_letter')"
                                list-type="picture-card"
                                :limit="1"
                                :on-exceed="fileExceed"
                                :auto-upload="false">
                                <i class="el-icon-plus"></i>
                                </el-upload>
                        </el-form-item>                                                                                    
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="contact_info.contact_name"
                            :rules="[
                            { required: true, message: '请输入超级管理员姓名', trigger: 'blur' },
                            ]">
                            <span class="start">*</span>
                            <span>超级管理员姓名：</span>
                            <el-input
                                v-model="form.contact_info.contact_name"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item>   
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="contact_info.contact_id_card_number"
                            :rules="[
                            { required: true, message: '请输入超级管理员身份证件号码', trigger: 'blur' },
                            {pattern: /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/,message: '证件号码格式有误！', trigger: 'blur'}                            
                            ]">
                            <span class="start">*</span>
                            <span>超级管理员身份证件号码：</span>
                            <el-input
                                v-model="form.contact_info.contact_id_card_number"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item> 
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="contact_info.mobile_phone"
                            :rules="[
                            { required: true, message: '请输入超级管理员手机', trigger: 'blur' },
                            { pattern: /^[1](([3][0-9])|([4][0,1,4-9])|([5][0-3,5-9])|([6][2,5,6,7])|([7][0-8])|([8][0-9])|([9][0-3,5-9]))[0-9]{8}$/,message: '手机号格式不对',trigger: 'blur'}
                            ]">
                            <span class="start">*</span>
                            <span>超级管理员手机：</span>
                            <el-input
                                v-model="form.contact_info.mobile_phone"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item>   
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="contact_info.contact_email"
                            :rules="[
                            { type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }
                            ]">
                            <span class="start">*</span>
                            <span>超级管理员邮箱：</span>
                            <el-input
                                v-model="form.contact_info.contact_email"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                             <div class="icon-image">
                                <img src="./img/ts.png" alt="提示">
                                <div class="prompt-icon">
                                    1、主体类型为“小微商户/个人卖家”可选填，其他主体需必填。
                                    2、用于接收微信支付的开户邮件及日常业务通知。
                                </div>                                   
                            </div>                             
                        </el-form-item>   
                        <div class="main-title">店铺信息:</div>    
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="sales_scene_info.store_name"
                            :rules="[
                            { required: true, message: '请输入店铺名称', trigger: 'blur' },
                            ]">
                            <span class="start">*</span>
                            <span>店铺名称：</span>
                            <el-input
                                v-model="form.sales_scene_info.store_name"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item> 
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="sales_scene_info.mini_program_sub_appid"
                            >
                            <span>APPID：</span>
                            <el-input
                                v-model="form.sales_scene_info.mini_program_sub_appid"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item> 
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="merchant_shortname"
                            :rules="[
                            { required: true, message: '请输入商户简称', trigger: 'blur' },
                            ]">
                            <span class="start">*</span>
                            <span>商户简称：</span>
                            <el-input
                                v-model="form.merchant_shortname"
                                autocomplete="off"
                                @input="changeinput($event)"
                            ></el-input>
                        </el-form-item>  
                        <el-form-item 
                            :label-width="formLabelWidth">
                            <span>特殊资质：</span>
                                <el-upload
                                class="upload-demo"
                                :file-list="fileList6"
                                action="#"
                                :on-change="(file, fileList6)=>handlePreview(file, fileList6,'qualifications')"
                                :on-remove="handleRemove"
                                list-type="picture-card"
                                :on-exceed="(file, fileList6)=>fileExceed(file, fileList6,'qualifications')"
                                :limit="5"
                                :auto-upload="false">
                                <i class="el-icon-plus"></i>
                                </el-upload>
                        </el-form-item>
                        <el-form-item                                   
                            :label-width="formLabelWidth">
                            <span>补充材料：</span>
                                <el-upload
                                class="upload-demo"
                                :file-list="fileList7"
                                action="#"
                                :on-change="(file, fileList7)=>handlePreview(file, fileList7,'business_addition_pics')"
                                :on-remove="handleRemove"
                                list-type="picture-card"
                                :on-exceed="(file, fileList7)=>fileExceed(file, fileList7,'business_addition_pics')"
                                :limit="5"
                                :auto-upload="false">
                                <i class="el-icon-plus"></i>
                                </el-upload>
                        </el-form-item> 
                        <el-form-item
                            :label-width="formLabelWidth"
                            prop="business_addition_desc"
                            :rules="[
                            { required:form.organization_type==2500?true:false, message: '请输入补充说明', trigger: 'blur' },
                            ]">
                            <span class="start">*</span>
                            <span>补充说明：</span>
                            <el-input
                            type="textarea"
                            :rows="4"
                            placeholder="请输入补充说明的内容"
                            v-model="form.business_addition_desc"
                            @input="changeinput($event)"
                            ></el-input>
                             <div class="icon-image">
                                <img src="./img/ts.png" alt="提示">
                                <div class="prompt-icon">
                                    1、可填写512字以内 。
                                    2、若主体为“个人卖家”，该字段必传，则需填写描述“ 该商户已持续从事电子商务经营活动满6个月，且期间经营收入累计超过20万元。”                              
                                </div>                                   
                            </div>                             
                        </el-form-item>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
                 </div>
                </el-form>
                </el-row>
                <div class="demo-drawer__footer" style="margin:20px 0 0 80px;">
                    <el-button @click="cancelForm($event)">取 消</el-button>
                    <el-button
                        type="primary"
                        @click="submitForm('form')"
                        :loading="loading"
                        >{{ loading ? "提交中 ..." : "确 定" }}</el-button
                    >
                </div>
            </div>
        </el-drawer>
    </div>
</template>
<script>
import { readSync } from 'fs';

export default {
    data() {
        return {
            loading: false,
            title:'',
            fileList1:[],
            fileList2:[],
            fileList3:[],
            fileList4:[],
            fileList5:[],
            fileList6:[],
            fileList7:[],
            fileList8:[],
            fileList9:[],
            fileList10:[],            
            mainlist:[],
            Certificate:[],
            accountlist:[
                {label:'是',value:1},
                {label:'否',value:0}
            ],
            contactlist:[],
            banktype:[],
            banklist:[],
            addresslist:[],
            province_child:[],
            city_child:[],
            area_code:'',
            city_code:'',
            province_code:'',
            code_arr:{},
            form: {
                store_id:'',
                out_request_no:'',
                organization_type: '',
                business_license_info: {
                    business_license_copy:[],
                    business_license_number:'',
                    merchant_name:'',
                    legal_person:'',
                    company_address:'',
                    business_time:''
                },
                organization_cert_info: {
                    organization_copy:'',
                    organization_time:'',
                    organization_number:''
                },
                id_doc_type:'',
                id_card_info: {
                    id_card_copy:'',
                    id_card_national:'',
                    id_card_name:'',
                    id_card_number:'',
                    id_card_valid_time:'',
                    id_card_valid_time_begin:'',
                    id_card_address:'', 
                },
                id_doc_info:{
                    id_doc_name:'',
                    id_doc_number:'',
                    id_doc_copy:'',
                    doc_period_end:'',
                },
                need_account_info: 1,
                account_info: {
                    bank_account_type:'',
                    account_name:'',
                    account_bank:'',
                    bank_address_code:'',
                    bank_branch_id:'',
                    bank_name:'',
                    account_number:''
                },
                contact_info: {
                    contact_type:'',
                    contact_name:'',
                    contact_id_card_number:'',
                    mobile_phone:'',
                    contact_email:'',
                    contact_id_doc_type:'IDENTIFICATION_TYPE_MAINLAND_IDCARD',
                    contact_id_doc_copy:[],
                    contact_id_doc_copy_back:[],
                    contact_id_doc_period_begin:'',
                    contact_id_doc_period_end:'',
                    business_authorization_letter:[],
                },
                sales_scene_info: {
                    store_name:'',
                    store_url:'',
                    store_qr_code:'',
                    mini_program_sub_appid:''
                },
                merchant_shortname:'',
                qualifications:[],
                business_addition_pics:[],
                business_addition_desc:'',
                sign_url:'',
                legal_validation_url:'',
                audit_detail:{
                    reject_reason:'',
                },                  
            },
            radio:0,
            formLabelWidth: '80px',
			timer: null,
			show_dialog:false,
            type:'add',          
        };
	},
    mounted(){
        console.log('1111',this.province_child);
    },
    methods: {
		show_dialog_fn(data,out_request_no,state){
			if(state==1){
				this.title = '编辑开户信息';
                this.getmember(data);
                this.form.store_id = data;
                this.form.out_request_no = out_request_no;                
			}else{
                this.title = '添加开户信息';
                this.form.store_id = data;
                this.form.out_request_no = out_request_no;
            }
            this.show_dialog = true;
            this.getbankaddress();       
            this.getmaintype();
            this.getCertificate();
            this.getcontacttype();
            this.getbanktype();
            this.getbanklist();
            // this.getBankBranch();
        },
        //输入框输入事件
        changeinput(e){
            this.$forceUpdate();
            // alert(this.form.business_license_info.business_license_number);
        },        
        // 获取超级管理员类型
        getcontacttype(){
            this.$http.post('/admin/bill/index.php?act=storeMchSetting&op=getContactTypes').then((res)=> {
                console.log(res);
                if (res.code == 1) {
                   for(var i in res.data){
                       res.data[i].value = res.data[i].value.toString();
                   }                    
                   this.contactlist = res.data;
                }else {
                    alert(res.msg);
                }
            })            
        }, 
        // 获取超级管理员类型
        // getBankBranch(){
        //     this.$http.post('/admin/bill/index.php?act=storeMchSetting&op=getBankBranch').then((res)=> {
        //         console.log(res);
        //         if (res.code == 1) {
        //            for(var i in res.data){
        //                res.data[i].value = res.data[i].value.toString();
        //            }                    
        //            this.contactlist = res.data;
        //         }else {
        //             alert(res.msg);
        //         }
        //     })            
        // },         
        // 获取地区编码
        getbankaddress(){
            this.$http.post('/admin/bill/index.php?act=storeMchSetting&op=getRegions').then((res)=> {
                console.log(res);
                if (res.code == 1) {
                   this.addresslist = res.data;
                }else {
                    alert(res.msg);
                }
            })            
        },   
        // 改变省之后市和区域为空
        changeProv(value) {
            var key = '';
            for(var i in this.addresslist){
                 if(this.addresslist[i].national_code == value){
                       this.province_child = this.addresslist[i].child; 
                 }
            }
            this.city_code = '';
            this.city_child = [];
            this.area_code = '';
            this.form.account_info.bank_address_code = '';            
        },
        // 改变市之后区域为空
        changeCity(value) {
            var key = '';
            this.area_code = '';
            this.form.account_info.bank_address_code = value;
            console.log(this.province_child);
            for(var i in this.province_child){
                 if(this.province_child[i].national_code == value){
                       this.city_child = this.province_child[i].child;   
                       console.log(this.city_child);
                 }
            }
        },
        // 改变区域
        changeArea(value) {
           this.form.account_info.bank_address_code = value;
        },               
       // 18种开户银行
        getbanklist(){
            this.$http.post('/admin/bill/index.php?act=storeMchSetting&op=getBanks').then((res)=> {
                console.log(res);
                if (res.code == 1) {
                   for(var i in res.data){
                       res.data[i].value = res.data[i].value.toString();
                   }                    
                   this.banklist = res.data;
                }else {
                    alert(res.msg);
                }
            })            
        },          
       // 获取账户类型
        getbanktype(){
            this.$http.post('/admin/bill/index.php?act=storeMchSetting&op=getBankAccountTypes').then((res)=> {
                console.log(res);
                if (res.code == 1) {
                   for(var i in res.data){
                       res.data[i].value = res.data[i].value.toString();
                   }                    
                   this.banktype = res.data;
                }else {
                    alert(res.msg);
                }
            })            
        },              
        // 获取主体类型
        getmaintype(){
            this.$http.post('/admin/bill/index.php?act=storeMchSetting&op=getOrganizationTypes').then((res)=> {
                console.log(res);
                if (res.code == 1) {
                   for(var i in res.data){
                       res.data[i].value = res.data[i].value.toString();
                   }                    
                   this.mainlist = res.data;
                }else {
                    alert(res.msg);
                }
            })            
        },       
        // 获取经营者/法人证件类型
        getCertificate(){
            this.$http.post('/admin/bill/index.php?act=storeMchSetting&op=getIdentificationTypes').then((res)=> {
                console.log(res);
                if (res.code == 1) {
                   for(var i in res.data){
                       res.data[i].value = res.data[i].value.toString();
                   }                    
                   this.Certificate = res.data;
                }else {
                    alert(res.msg);
                }
            })            
        },    
        //复制
        copyUrl(data){
            let url = data;
            let oInput = document.createElement('input');
            oInput.value = url;
            document.body.appendChild(oInput);
            oInput.select(); // 选择对象;
            console.log(oInput.value)
            document.execCommand("Copy"); // 执行浏览器复制命令
            this.$message({
            message: '已成功复制到剪切板',
            type: 'success'
            });
         },              
        // 获取开户信息 编辑
        
        getmember(id){
            this.$http.post('/admin/bill/index.php?act=storeMch&op=mchDetail&store_id='+id).then((res)=> {
                console.log(res);
                if (res.code == 1) {  
                    this.form.organization_type = res.data.organization_type;
                    this.form.business_license_info = res.data.business_license_info;
                    this.form.id_doc_type = res.data.id_doc_type;
                    this.form.id_doc_info = res.data.id_doc_info;
                    this.form.need_account_info = res.data.need_account_info==true?1:0;
                    this.form.account_info = res.data.account_info;
                    this.form.contact_info = res.data.contact_info;
                    this.form.sales_scene_info = res.data.sales_scene_info;
                    this.form.merchant_shortname = res.data.merchant_shortname;
                    this.form.business_addition_desc = res.data.business_addition_desc;
                    this.form.organization_cert_info = res.data.organization_cert_info;  
                    if(res.data.id_card_info){
                        this.form.id_card_info = res.data.id_card_info;
                    }
                    this.code_arr = res.data.account_info.bank_address_code_arr; 
                        //地区选择 
                    if(this.code_arr!=''&&this.code_arr!=undefined){      
                        for(var j in this.addresslist){
                            if(this.code_arr[0]==this.addresslist[j].national_code){
                            this.province_child = this.addresslist[j].child
                            this.province_code = this.code_arr[0].toString();
                            for(var i in this.province_child){
                                if(this.code_arr[1]==this.province_child[i].national_code){
                                this.city_code = this.code_arr[1].toString();
                                if(this.code_arr.length>2){
                                    this.city_child = this.province_child[i].child;
                                    //form.account_info.bank_address_code = this.code_arr[2];
                                    for(var k in this.city_child){
                                        if(this.code_arr[2] == this.city_child[k].national_code){
                                            // this.form.account_info.bank_address_code = this.code_arr[2].toString();
                                            this.area_code = this.code_arr[2].toString();
                                        }
                                    }
                                }
                                }
                            }
                        
                        }
                        }
                    }

                    // 图片展示
                    if(res.data.business_license_info){
                        this.fileList1 = [res.data.business_license_info.business_license_copy];
                        this.form.business_license_info.business_license_copy = res.data.business_license_info.business_license_copy.media_id;
                    }
                     if(res.data.organization_cert_info){
                      this.fileList2 = [res.data.organization_cert_info.organization_copy];
                      this.form.organization_cert_info.organization_copy = res.data.organization_cert_info.organization_copy.media_id;
                     } 
                     if(res.data.id_card_info){
                      this.fileList3 = [res.data.id_card_info.id_card_copy];
                      this.form.id_card_info.id_card_copy = res.data.id_card_info.id_card_copy.media_id?res.data.id_card_info.id_card_copy.media_id:'';
                     }
                     if(res.data.id_card_info){
                     this.fileList4 = [res.data.id_card_info.id_card_national];
                     this.form.id_card_info.id_card_national = res.data.id_card_info.id_card_national.media_id?res.data.id_card_info.id_card_national.media_id:'';
                     }
                     if(res.data.id_doc_info){
                     this.fileList5 = [res.data.id_doc_info.id_doc_copy];
                     this.form.id_doc_info.id_doc_copy = res.data.id_doc_info.id_doc_copy.media_id?res.data.id_doc_info.id_doc_copy.media_id:'';
                     }
                     if(res.data.qualifications){
                      this.fileList6 = res.data.qualifications;
                      for(var i in res.data.qualifications){
                        this.form.qualifications.push(res.data.qualifications[i].media_id);
                      }   
                     }
                     if(res.data.business_addition_pics){
                      this.fileList7 = res.data.business_addition_pics;
                      for(var i in res.data.business_addition_pics){
                        this.form.business_addition_pics.push(res.data.business_addition_pics[i].media_id);  
                      }
                     }   
                     if(res.data.contact_info.contact_id_doc_copy){
                        this.fileList8 = [res.data.contact_info.contact_id_doc_copy];
                        this.form.contact_info.contact_id_doc_copy = res.data.contact_info.contact_id_doc_copy.media_id?res.data.contact_info.contact_id_doc_copy.media_id:'';                        
                     }
                     if(res.data.contact_info.contact_id_doc_copy_back){
                        this.fileList9 = [res.data.contact_info.contact_id_doc_copy_back];
                        this.form.contact_info.contact_id_doc_copy_back = res.data.contact_info.contact_id_doc_copy_back.media_id?res.data.contact_info.contact_id_doc_copy_back.media_id:'';                            
                     }
                     if(res.data.contact_info.business_authorization_letter){
                        this.fileList10 = [res.data.contact_info.business_authorization_letter];
                        this.form.contact_info.business_authorization_letter = res.data.contact_info.business_authorization_letter.media_id?res.data.contact_info.business_authorization_letter.media_id:'';                         
                     }                                          
                     console.log(this.form.business_addition_pics);   
                     console.log(this.form.qualifications);   
                    delete this.form.account_info.bank_account_type_desc; 
                    // delete this.form.account_info.bank_address_code_arr; 
                    delete this.form.account_info.bank_address_code_desc; 
                    // delete this.form.contact_info.contact_type_desc;           
                    console.log(this.form.contact_info);                                         
                }else {
                    alert(res.msg);
                }
            })            
        },        
        // 新增
        submitForm(formName){         
        this.loading = true;
        var data = this.form;
        setTimeout(() => {
            this.loading = false;
        }, 400);            
        this.$refs[formName].validate((valid) => {
          if (valid) {
                this.$http.post('/admin/bill/index.php?act=storeMch&op=ecommerceApplyments',data).then((res)=> {
                    console.log(res);
                    if (res.code == 1) {
                        this.$message({
                            showClose: true,
                            message: '操作成功',
                            type: 'success'
                        });
                        // setTimeout(() => {
                        //     this.show_dialog = false;
                        //     this.form=[];
                        //     this.$refs.upload.clearFiles()
                        // }, 1000);                         
                    }else {
                        this.$message({
                            showClose: true,
                            message: res.msg,
                            type: 'error'
                        });                    
                    }
                })                

          } else {
            return false;
          }
        });                  
        },
        handleClose(done) {
             this.cancelForm();
        },     
        cancelForm() {
			//done 用于关闭 Drawer
            if (this.loading) {
                return;
            }
            this.$confirm('确定要关闭表单吗？')
                .then(_ => {
                    this.show_dialog = false;
                    this.form.organization_type = '';
                    this.form.business_license_info = {};
                    this.form.id_doc_type = '';
                    this.form.id_doc_info = {};
                    this.form.need_account_info =1;
                    this.form.account_info = {};
                    this.form.contact_info = {
                        contact_id_doc_type:'IDENTIFICATION_TYPE_MAINLAND_IDCARD'
                    };
                    this.form.sales_scene_info = {};
                    this.form.merchant_shortname = '';
                    this.form.qualifications = [];
                    this.form.business_addition_pics = [];
                    this.form.business_addition_desc = '';
                    this.form.organization_cert_info = {}; 
                    this.form.id_card_info = {};
                    this.fileList1 = [];
                    this.fileList2 = [];
                    this.fileList3 = [];
                    this.fileList4 = [];
                    this.fileList5 = [];
                    this.fileList6 = [];
                    this.fileList7 = [];
                    this.fileList8 = [];
                    this.fileList9 = [];
                    this.fileList10 = [];                    
                    this.province_child=[];
                    this.city_child=[];
                    this.area_code='';
                    this.city_code='';
                    this.province_code='';   
                    this.form.account_info.bank_address_code = '';           
                    this.code_arr = [];   
                    this.$emit('getList');
                    //重置表单
                    // this.$refs.form.resetFields();
                    //重置表单验证
                    this.$refs.form.clearValidate();
                })
                .catch(_ => { });            
            // this.loading = false;
            // this.show_dialog = false;
            // this.form.organization_type = '';
            // this.form.business_license_info = {};
            // this.form.id_doc_type = '';
            // this.form.id_doc_info = {};
            // this.form.need_account_info ='';
            // this.form.account_info = {};
            // this.form.contact_info = {};
            // this.form.sales_scene_info = {};
            // this.form.merchant_shortname = '';
            // this.form.qualifications = '';
            // this.form.business_addition_pics = '';
            // this.form.business_addition_desc = '';
            // this.form.organization_cert_info = {};  
            // this.form.id_card_info = {};
            // this.$refs.upload.clearFiles();
            // clearTimeout(this.timer);
        },
        handleRemove(file, fileList,name) {
        //   this.fileList = fileList;
             console.log(file);
             console.log(fileList)
             console.log(name)
             if(name=='contact_id_doc_copy'){
                this.form.contact_info.contact_id_doc_copy = '';
             }
             if(name=='contact_id_doc_copy_back'){
                this.form.contact_info.contact_id_doc_copy_back = '';
             }    
             if(name=='business_authorization_letter'){
                this.form.contact_info.business_authorization_letter = '';
             }                      
         },
        handlePreview(file, fileList,name) {
          var formData=new FormData();
          formData.append("upload_file",file.raw); 
          formData.append("store_id",this.form.store_id);
          if(file.raw.size>2097152){
              fileList = '';
                this.$message({
                showClose: true,
                message: '上传文件不得大于2M',
                type: 'error'
                });    
                return;          
          }
          this.$http.post('/admin/bill/index.php?act=storeMch&op=merchantMediaUpload',formData).then((res)=> {
              if(res.code==1){
                    if(fileList.length>1){
                    if(name=="qualifications"){
                        this.form.qualifications.push(res.data.media_id);
                        }else if(name=="business_addition_pics"){
                        this.form.business_addition_pics.push(res.data.media_id);
                        }                 
                    }else{
                        if(name=='business_license_copy'){
                        this.form.business_license_info.business_license_copy = res.data.media_id;
                        }else if(name=='organization_copy'){
                        this.form.organization_cert_info.organization_copy = res.data.media_id
                        }else if(name=="id_card_copy"){
                        this.form.id_card_info.id_card_copy = res.data.media_id
                        }else if(name=="id_card_national"){
                        this.form.id_card_info.id_card_national = res.data.media_id
                        }else if(name=="id_doc_copy"){
                        this.form.id_doc_info.id_doc_copy = res.data.media_id
                        }else if(name=="qualifications"){
                        this.form.qualifications = [res.data.media_id]
                        }else if(name=="business_addition_pics"){
                        this.form.business_addition_pics = [res.data.media_id]
                        }else if(name=="contact_id_doc_copy"){
                        this.form.contact_info.contact_id_doc_copy = res.data.media_id
                        }else if(name=="contact_id_doc_copy_back"){
                        this.form.contact_info.contact_id_doc_copy_back = res.data.media_id
                        }else if(name=="business_authorization_letter"){
                        this.form.contact_info.business_authorization_letter = res.data.media_id
                        }    
                    } 
              }else{
                this.$message({
                showClose: true,
                message: res.msg,
                type: 'error'
                });
              }
  
              console.log(this.form);           
          })
        }, 
         fileExceed:function(files, fileList,name){   
             console.log(files.raw);    
  
             if(name=='qualifications'||name=='business_addition_pics'){
                this.$message.warning(`当前限制选择5个文件，本次选择了 ${files.length} 个文件，共选择了 ${fileList.length} 个文件`)  
             }else{
                this.$message.warning(`当前限制选择1个文件，本次选择了 ${files.length} 个文件，共选择了 ${fileList.length} 个文件`)             
             }
            
         },         
    }
};
</script>
<style lang="scss" scoped>
.main-title{
    margin:10px 0px 10px 60px;
    font-weight: 600;
}
.local-hide{
    display: none;
}
#form{
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
}
#form>div{
    width: 45%;
}
// .head-box{
//     overflow: scroll;
// }
.el-form-item{
    span{
        margin-top: 5px;
    }
    .rules-span{
      display: none;
    }
}
.rules-member1{
    position: absolute;
    // left: 430px;
    width: 100px;
    top: 35px;
    color: #F56C6C;
}
// .rules-member >>> .el-input__inner {
.rules-member /deep/.el-input__inner{
    border: 1px solid #F56C6C;
}
/deep/.el-drawer__body{
    overflow-y:auto ;
    padding-bottom: 30px;
}
.el-form-item__content{
    line-height: 30px;
}
#el-drawer__title{
    padding-bottom: 10px;
}
#el-drawer__header {
    margin-bottom: 15px;
}
span{
    color: #606266;
}
span.start{
    color: red;
}
.addstore {
  .el-input,
  .el-select,
  .el-cascader,
  .el-textarea {
    width: 300px;
    display: block;
  }
}
.icon-image{
    position: absolute;
    left: 340px;
    top: 30px;
    width: 15px;
    height: 15px;
    cursor: pointer;
    img{
        width: 15px;
    }
}
.prompt-icon{
    display: none;
    position: absolute;
    width: 300px;
    font-size: 10px;
    line-height: 20px;
    z-index: 999;
    background: #000;
    color: #fff;
    opacity: 0.8;
    text-indent: 2em;
    padding: 5px;
}
.icon-image:hover .prompt-icon{
    display: block;
}
.fuzhi{
    position:absolute;
    left: 320px;
    top: 26px;
}
</style>